TESTING.....
2D array start with a variable type follow by two []s.
  • example: double[] [] x = new double [3] [5]
this make an array of 3 rows and 5 cols
like normal array, to modify an 2D array can be done like this: x[1] [1] = 2.0;

To found the rows and columns of a two 2D array:
  • x.length <---- number of rows
  • x[0].length <---- number of columns

for example:
import objectdraw.*;
import java.awt.*;
import java.util.Random;
public class colorGrid extends FrameWindowController
{
 private FilledRect[][] grids;
 private Random rand;
 public void begin()
 {
     grids = new FilledRect[10][10];
     rand = new Random();
     for( int y = 0 ; y < grids[0].length ; y++)
     {
         for( int x = 0; x < grids.length; x++)
         {
         grids[x][y] = new FilledRect(100 + x*20, 100 + y*20, 20 , 20, canvas);
         grids[x][y].setColor( new Color( rand.nextInt(255),rand.nextInt(255),rand.nextInt(255)));
        }
     }
 }
}
 
this make FilledRect like this :
PIN001.png